A sine wave or sinusoid is a mathematical curve that describes a smooth repetitive oscillation. A sine wave is a continuous wave. It is named after the function sine, of which it is the graph. It occurs often in pure and applied mathematics, as well as physics, engineering, signal processing and many other fields.
x <- seq(0, 10, length.out = 1000)
aval <- list()
for (step in 1:11) {
aval[[step]] <- list(visible = FALSE,
name = paste0('v = ', step),
x = x,
y = sin(step * x))
}
aval[3][[1]]$visible = TRUEsteps <- list()
p <- plot_ly()
for (i in 1:11) {
p <- add_lines(p, x = aval[i][[1]]$x, y = aval[i][[1]]$y, visible = aval[i][[1]]$visible,
name = aval[i][[1]]$name, type = 'scatter', mode = 'lines', hoverinfo = 'name',
line = list(color = '00CED1'), showlegend = FALSE)
step <- list(args = list('visible', rep(FALSE, length(aval))),
method = 'restyle')
step$args[[2]][i] = TRUE
steps[[i]] = step
}p <- p %>%
layout(sliders = list(list(active = 3,
currentvalue = list(prefix = "Frequency: "),
steps = steps)))
p